import React from "react"
import {createPlusAction, createMinusAction} from "../../redux/count_reducer"
import {connect} from "react-redux"

function CountUI(props) {
  const plus=()=>{
    props.plus(1)
  }
  const minus=()=>{
    props.minus(1)
  }

  return (
    <div>
    <p>结果:{props.counter.value}</p>
    <button onClick={plus}>+</button>
    <button onClick={minus}>-</button>
  </div>
  )
}

export default connect(
  state=>state,
  {
    plus:createPlusAction,
    minus:createMinusAction
  }
  )(CountUI)
